﻿//using System;
//using NUnit.Framework;

//namespace Simhopp.Common
//{
//    /// <summary>
//    /// A test class for the Dive class.
//    /// </summary>
//    [TestFixture]
//    public class TestDive
//    {
//        #region FIELD REGION
//        private Dive defaultDive;
//        private Dive dive;
//        private const int TestNumberOfJudges = 7;
//        private const double TestScoreValue = 5.0;
//        #endregion
//        #region TEST METHOD REGION
//        [SetUp]
//        public void Init()
//        {
//            defaultDive = new Dive();
//            dive = new Dive("001A", "Forward Thrust", Heights.ThreeMetres, 1.0);
//            Dive.NumberOfJudges = TestNumberOfJudges;
//        }

//        [Test]
//        public void TestConstructors()
//        {
//            Assert.AreEqual("001A", dive.ID);
//            Assert.AreEqual("Forward Thrust", dive.TypeName);
//            Assert.AreEqual(Heights.ThreeMetres, dive.Height);
//            Assert.AreEqual(1.0, dive.DifficultyFactor);
//            Assert.AreEqual(0, dive.ScoreCount);

//            Assert.AreEqual("", defaultDive.ID);
//            Assert.AreEqual("", defaultDive.TypeName);
//            Assert.AreEqual(Heights.DEFAULT, defaultDive.Height);
//            Assert.AreEqual(0, defaultDive.ScoreCount);
//        }

//        [Test]
//        public void TestProperties()
//        {
//            defaultDive.ID = "002B";
//            defaultDive.TypeName = "Backward Twirl";
//            defaultDive.Height = Heights.FiveMeters;
//            defaultDive.DifficultyFactor = 1.0;

//            Assert.AreEqual("002B", defaultDive.ID);
//            Assert.AreEqual("Backward Twirl", defaultDive.TypeName);
//            Assert.AreEqual(Heights.FiveMeters, defaultDive.Height);
//            Assert.AreEqual(1.0, defaultDive.DifficultyFactor);
//        }

//        [Test, ExpectedException(typeof(InvalidNumberOfJudgesException))]
//        public void TestNumberOfJudgesConstraint()
//        {
//            Dive.NumberOfJudges = 6;
//            //This should throw an exception, since the number of judges must be either 5 or 7.
//        }

//        [Test, ExpectedException(typeof(NotSupportedException))]
//        public void TestAddScoreToScoresProperty()
//        {
//            defaultDive.RemoveAllScores();
//            defaultDive.Scores.Add(new Score());
//            //This should throw an exception, since the score list returned from Scores is read only.
//        }

//        [Test, ExpectedException(typeof(NotSupportedException))]
//        public void TestAssignScoreToScoresProperty()
//        {
//            defaultDive.RemoveAllScores();
//            defaultDive.Scores[0] = new Score();
//            //This should throw an exception, since the score list returned from Scores is read only.
//        }

//        [Test]
//        public void TestRemoveAllScores()
//        {
//            defaultDive.AddScore(new Score());
//            defaultDive.AddScore(new Score());
//            defaultDive.AddScore(new Score());
//            Assert.AreEqual(3, defaultDive.ScoreCount);

//            defaultDive.RemoveAllScores();
//            Assert.AreEqual(0, defaultDive.ScoreCount);
//        }

//        [Test, ExpectedException(typeof(ScoreListEmptyException))]
//        public void TestRemoveScoreEmpty()
//        {
//            defaultDive.RemoveAllScores();
//            defaultDive.RemoveScore(new Score());
//            //This should throw an exception, since the score list is empty.
//        }

//        [Test]
//        public void TestRemoveScore()
//        {
//            Score score1 = new Score(new Judge(), 1.0);
//            Score score2 = new Score(new Judge(), 1.0);
//            defaultDive.RemoveAllScores();
//            defaultDive.AddScore(score1);
//            defaultDive.AddScore(score2);
//            Assert.AreEqual(2, defaultDive.ScoreCount);
//            defaultDive.RemoveScore(score1);
//            Assert.AreEqual(1, defaultDive.ScoreCount);
//        }

//        [Test]
//        public void TestAddScore()
//        {
//            defaultDive.RemoveAllScores();
//            defaultDive.AddScore(new Score());
//            Assert.AreEqual(1, defaultDive.ScoreCount);
//        }

//        [Test, ExpectedException(typeof(ScoreListFullException))]
//        public void TestAddScoreTooMany()
//        {
//            defaultDive.RemoveAllScores();
//            for (int i = 0; i < Dive.NumberOfJudges + 1; i++)
//            {
//                defaultDive.AddScore(new Score(new Judge(), TestScoreValue));
//            }
//            //This should throw an exception, since the ScoreCount exceeds the number of judges.
//        }

//        [Test]
//        public void TestGetTotalScore()
//        {
//            defaultDive.RemoveAllScores();
//            for (int i = 0; i < Dive.NumberOfJudges; i++)
//            {
//                dive.AddScore(new Score(new Judge(), TestScoreValue + (double)i));
//            }
//            Assert.AreEqual(40.0, dive.GetTotalScore());
//        }

//        [Test, ExpectedException(typeof(ScoreListNotCompleteException))]
//        public void TestGetTotalScoreNotFull()
//        {
//            defaultDive.RemoveAllScores();
//            defaultDive.GetTotalScore();
//        }

//        [TearDown]
//        public void Terminate()
//        {

//        }
//        #endregion
//    }
//}
